<template>
    <div>
        <h2>学生姓名：{{obj.name}}</h2>
        <h2>学生年龄:{{obj.age}}</h2>
        <h2>{{obj.objx.kk}}</h2>
        <h2>{{obj.objx.kkv}}</h2>
        <h2>{{obj.mm}}</h2>
        <h2>{{obj.cc}}</h2>
        <h2>{{obj.hobby}}</h2>
        <button @click="sendMessage2">发送消息</button>
    </div>
</template>
<script>
import {ref,reactive} from 'vue'

export default {
    name:'Test',
    setup() {
        
        const obj = reactive({
            name:'张三',
            age:18,
            objx:{
                kk:'kk',
                kkv:'kkv'
            },
            mm:'231',
            cc:'5231',
            hobby:['打球','打网球','打高尔夫']
        })
        
        function sendMessage2(){
            obj.name = '李四'
            obj.age = '45'
            obj.objx.kk = 'll'
            obj.objx.kkv = 'lz'
            obj.mm = '231'
            obj.cc = 'oo'
            obj.hobby[0] = '色色'
        }

        return{
            obj,
            sendMessage2
        }
    }
}
</script>
<style>
    
</style>